package com.csdj.controller.Be;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.csdj.common.enums.AppHttpCodeEnum;
import com.csdj.common.utils.ResponseResult;
import com.csdj.pojo.PyUserhistory;
import com.csdj.service.PyUserhistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/pyUserHistory")
@RestController
public class PyUserHistoryController {
    @Autowired
    private PyUserhistoryService pyUserhistoryService;

    /**
     * 根据用户id获取详单
     */
    @GetMapping
    public ResponseResult getByName(Integer id){
        LambdaQueryWrapper<PyUserhistory> l=new LambdaQueryWrapper<>();
        l.eq(PyUserhistory::getUserNo,id);
        PyUserhistory one = pyUserhistoryService.getOne(l);
        return one!=null?ResponseResult.okResult(one):ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"空");
    }
}
